﻿using Film8.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Web;


namespace Film8.DAL
{
    public class Film8Context : DbContext
    {
   

            public Film8Context()
                : base("Film8Context")
            {
            }

            public DbSet<Movie> Movies { get; set; }
            public DbSet<Director> Directors { get; set; }
            public DbSet<Fan> Fans { get; set; }

            protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {

                modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            }
           /* protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                //one-to-many
                modelBuilder.Entity<Director>().HasMany<Movie>(s => s.Movies)
                .WithRequired(s => s.director).HasForeignKey(s => s.Id);
            }*/
        
        
    }
}